package cn.com.contec.util;



import cn.com.contec.R;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.text.Html;

/**
 * 
 * @author 李青
 * 
 */
public class DialogTool {

	
	public static void info(Context context, String msg) {
		AlertDialog.Builder b = new AlertDialog.Builder(context);
		b.setTitle("信息");
		b.setMessage(Html.fromHtml(msg));
		DialogInterface.OnClickListener pl = new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
			}
		};
		b.setPositiveButton("OK", pl);
		b.create().show();
	}

	public static void alert(final Context context,String message,String title) {
		AlertDialog.Builder b = new AlertDialog.Builder(context);
		b.setTitle(title);
		b.setMessage(Html.fromHtml(message));
		DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				
			}
		};
		b.setOnCancelListener(new OnCancelListener() {
			public void onCancel(DialogInterface dialog) {
				
			}
		});
		b.setPositiveButton("OK", listener);
		b.create().show();
	}
	public static void confirm(final Context context,String message,String title) {
		DialogInterface.OnClickListener ok = new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
			}
		};
		DialogInterface.OnClickListener cancel = new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
			}
		};

		OnCancelListener cancel_listener = new OnCancelListener() {
			public void onCancel(DialogInterface dialog) {
				
			}
		};
		AlertDialog.Builder builder = new AlertDialog.Builder(context);
		builder.setTitle(title);
		builder.setMessage(message);
		builder.setPositiveButton(R.string.alert_ok, ok);
		builder.setNegativeButton(R.string.cancel, cancel);
		builder.setOnCancelListener(cancel_listener);
		builder.create().show();
	}
	
	
		
	
}